#!/usr/bin/env node

import consola from "consola";
import { ensureDir } from "fs-extra";
import { prompt } from "inquirer";

import Generator from "./generator";

const PROMPTS = [
  {
    type: "input",
    name: "name",
    message: "Your project name",
  },
];

async function run() {
  const { name } = await prompt(PROMPTS);
  try {
    await ensureDir(name);
    const generator = new Generator(name);
    await generator.run();
  } catch (e) {
    consola.error(e);
  }
}

run();
